package cn.edu.cqvie.netty.handler.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

public class MyClientHandler extends SimpleChannelInboundHandler<Long> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Long msg) throws Exception {
        System.out.println(ctx.channel().remoteAddress() + "," + msg);
        System.out.println("client output: " + msg);
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) throws Exception {
//        ctx.writeAndFlush(123451L);
//        ctx.writeAndFlush(123452L);
//        ctx.writeAndFlush(123453L);
        ctx.writeAndFlush(123456L);

//        ctx.writeAndFlush("2121212");
//        ctx.writeAndFlush(Unpooled.copiedBuffer("hello world!" , Charset.forName("utf-8")));
    }
}
